package greedy;

import java.util.Arrays;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class findContentChildren {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int i = g.length - 1;
        int j = s.length - 1;
        int result = 0;
        while (j >= 0 && i >= 0){
            if (s[j] >= g[i]){
                result++;
                j--;
            }
            i--;
        }
        return result;
    }
}
